perm filename MAPTST.PAL[HAL,HE]1 blob
sn#183687 filedate 1975-10-31 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00006 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 This is a test program to try out some ideas about the
C00004 00003 Map definitions
C00006 00004 COMMON, PINIT, TOSPC
C00008 00005 DRIVER
C00010 00006 .END
C00015 ENDMK
C⊗;
COMMENT ⊗ This is a test program to try out some ideas about the
proper use of the glorious Panofsky map. We will set up four maps,
each of which shares locations 0 → 17777 and 120000 → 177777. The
locations 20000 → 30000 will be distinct for each of the four maps.
Into each of these areas will be assembled a printing routine (which
will identify which county it is in) and a call to each of the other
county's map routines. Calling an unreachable location will be done
by this code:
MOV #LNAME,-(SP) ;The link name of the routine
JSR PC,SWITCH ;A routine in common space to do it all
The link name is an pointer into the link table. Each entry in that
table is two words. The second is the number of the appropriate
county (0:3), and the first is the address in that county's scheme.
The switch routine will keep track of the stack and will set the
return address to something in itself. It will therefore also have
to fix up the return. ⊗
; Map definitions
;Page tables
PTAB0 = 166000 ;100 words, 1 per page
PTAB1 = 166200 ;100 words, 1 per page
PTAB2 = 166400 ;100 words, 1 per page
PTAB3 = 166600 ;100 words, 1 per page
;Page table entries (each one for 2000 bytes)
WRINTO == 100000 ;Page has been written into
ACCESD == 40000 ;Page has been accessed
WRPERM == 20000 ;Page may be written into
RDPERM == 10000 ;Page may be read from
UNIBIT == 4000 ;on => unibus only. off => fastbus only
PHSPAG == 3777 ;high order address bits of physical page
;Map space table
KISPCE = 167020 ;Kernel I space
KDSPCE = 167022 ;Kernel D space
SISPCE = 167024 ;Supervisor I space
SDSPCE = 167026 ;Supervisor D space
UISPCE = 167034 ;User I space
UDSPCE = 167036 ;User D space
;Map space table entries
PTABNO == 1400 ;The page table (0:3) to use for this space
TRANSP == 200 ;1 => no mapping
MXVRPG == 176 ;Maximum page that may be referenced
;Status registers
STATR0 = 167000 ;Status register 0
MAPENB == 100000 ;1 => enable mapping
; COMMON, PINIT, TOSPC
.=1000
.INSRT HALHED[HAL,HE]
COMMON:
Comment ⊗ Takes the page table start address in R0 (PTAB0:PTAB3).
Sets virtual memory 0-17777 and 120000-177777 to the equivalent
physical memory. ⊗
MOV R2,-(SP) ;Save R2
MOV #UNIBIT+WRPERM+RDPERM,R1 ;Page table entry
MOV #70,R2 ;Number of entries for low common page table
COM1: MOV R1,(R0)+ ;Put in the entry
SOB R2,COM1 ;Repeat
MOV #UNIBIT+WRPERM+RDPERM+370,R1 ;page 370 (phys. add. 760000)
MOV #10,R2 ;Number of entries for high common page table
COM3: MOV R1,(R0)+ ;Put in the entry
INC R1 ;Set for next physical page
SOB R2,COM3 ;Repeat
MOV (SP)+,R2 ;Restore R2
RTS PC ;Done
PINIT:
; Set up the four page tables
MOV #PTAB0,R0 ;Clear all page table entries to start with
MOV #400,R1 ;
PINI0: CLR (R0)+ ;
SOB R1,PINI0 ;
;Page table 0
MOV #PTAB0,R0 ;
JSR PC,COMMON ;
MOV #PTAB1,R0 ;
JSR PC,COMMON ;
MOV #PTAB2,R0 ;
JSR PC,COMMON ;
MOV #PTAB3,R0 ;
JSR PC,COMMON ;
RTS PC ;Done with PINIT
;turn it all on, hope it works.
ENABLE: ;Takes the max page code in R0
MOV R0,KISPCE ;
MOV R0,KDSPCE ;
MOV R0,SISPCE ;
MOV R0,SDSPCE ;
MOV R0,UISPCE ;
MOV R0,UDSPCE ;
MOV #MAPENB,STATR0 ;Turns it on.
RTS PC ;Done
; DRIVER
PATCH: .BLKW 100 ;Patch area
MAXP: .WORD 0
STACK: .WORD 100 ;Stack
STACE: .WORD 0 ;end of stack
DRIVER:
MOV #STACE,SP ;Initialize stack
CLR MAXP ;Start with 0 max page
JSR PC,PINIT ;
MOV #100,R2 ;R2 ← Count of how many pages to try
LOOP: MOV MAXP,R0 ;R0 ← max page currently allowed
ASL R0 ;Put in usual format
JSR PC,ENABLE ;turns on the mapping with this max page
MOV MAXP,R0 ;
ASH 10,R0 ;Makes an address in the max page
TST (R0) ;Try it out
INC MAXP ;
SOB R2,LOOP ;Again.
JMP DDT ;
TRP:
.=250
TRP
352 ;Processor status word
.=TRP
BIC #100000,STATR0 ;Clear mapping
JMP DDT ;
.END